package com.suyu.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tmh
 * @date 2023/9/25 21:26
 * @description
 */
//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> excludePath= new ArrayList<>();
        excludePath.add("/user/register");
        excludePath.add("/user/getVerifyCode");
        excludePath.add("/user/login");
        excludePath.add("/user/get/login");
        excludePath.add("/user/register");
        registry.addInterceptor(new LoginInterceptor()).excludePathPatterns(excludePath)
        .excludePathPatterns("/doc.html/**")
        .excludePathPatterns("/doc.html#/**");
    }
}
